// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   UserUuidService.java

package com.nervytech.tutorcruise.db.service.impl;

import com.nervytech.tutorcruise.db.dao.interfaces.IUserUuidDAO;
import com.nervytech.tutorcruise.db.dao.model.UserUuid;
import com.nervytech.tutorcruise.db.service.interfaces.IUserUuidService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("userUuidService")
public class UserUuidService implements IUserUuidService {

	private static final Logger logger = LoggerFactory.getLogger("");

	@Autowired
	private IUserUuidDAO usrUuidDAO;

	public String getUuid(long userId, int type) {
		String uuid = null;
		try {
			uuid = usrUuidDAO.getUuid(userId, type);
		} catch (Exception e) {
			logger.error("Error while retreiving user detail.", e);
			throw new RuntimeException(e.getMessage());
		}
		return uuid;
	}

	public long getUserId(String uuId) {
		long userId = 0L;
		try {
			userId = usrUuidDAO.getUserId(uuId);
		} catch (Exception e) {
			logger.error("Error while retreiving user detail.", e);
			throw new RuntimeException(e.getMessage());
		}
		return userId;
	}

	public void deleteUuid(String uuId) {
		try {
			usrUuidDAO.deleteUuid(uuId);
		} catch (Exception e) {
			logger.error("Error while retreiving user detail.", e);
			throw new RuntimeException(e.getMessage());
		}
	}

	public void saveUuid(UserUuid usrUuid) {
		try {
			usrUuidDAO.saveUuid(usrUuid);
		} catch (Exception e) {
			logger.error("Error while retreiving user detail.", e);
			throw new RuntimeException(e.getMessage());
		}
	}

	public boolean isValidUuid(UserUuid usrUuid, String emailId) {
		boolean isUserExist = false;
		try {
			isUserExist = usrUuidDAO.isValidUuid(usrUuid, emailId);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage());
		}
		return isUserExist;
	}

}
